home *** CD-ROM | disk | FTP | other *** search
- {ViewIt 2.03 Demonstration Program}
- {©FaceWare 1991-92. All Rights Reserved.}
-
- program vDemoLP;
- {$I-}
-
- uses
- FaceStorLP, FaceProcLP;
-
- var
- helpShown: boolean;
- myRec: record
- myInteger: integer;
- myReal: real;
- myString: string[99];
- myFlags: longint;
- end;
- theReal: real;
-
- procedure JumpIt (thePtr: Ptr);
- inline
- $2257, $2051, $4E90;
-
- procedure OverProc (thePtr: Ptr);
- var
- delta: real;
- theArrow: ControlHandle;
- begin
- with fRec do
- if (cResID = 1000) then {Arrow Controls}
- begin
- if (uCommand = 8) then {a mouse down message?}
- begin
- delta := 0.001 * (cMin - 2);
- theArrow := cControl;
- HiliteControl(theArrow, 1);
- while StillDown do
- begin
- myRec.myReal := myRec.myReal + delta;
- FaceIt(nil, SetVal, 0, 0, 2, 2);
- Delay(5, uI4);
- end;
- HiliteControl(theArrow, 0);
- exit(OverProc);
- end;
- end
- else {Editable Text Item}
- begin
- if (uCommand = 264) then {a key down message?}
- if (uParam[1] = 32) then {SPACE key pressed?}
- uParam[1] := 95; {convert to UNDERLINE}
- end;
- JumpIt(thePtr); {pass message to driver}
- end;
-
- begin
- myRec.myInteger := 0;
- myRec.myReal := 6.2;
- myRec.myString := 'Hello';
- myRec.myFlags := 10;
- theReal := 6.0;
-
- {Initialize FaceIt}
- fRec.uName := 'vDemo.Rsrc';
- FaceIt(nil, DoInit, 0, 0, 0, 0);
-
- {Show ViewIt On-Line Help (if available)}
- FaceIt(nil, HlpWnd, 0, 0, 10, 10);
-
- {Open Modeless Window using FWND 1000}
- FaceIt(nil, NewWnd, 1000, 1, 0, 0);
-
- with fRec do
- repeat
- FaceIt(nil, DoLoop, 0, 0, 0, 0);
- {Standard "About" Menu Item Selection}
- if (uMenuID = 101) and (uMenuItem = 1) then
- begin
- uString := concat('Demonstration of the use of ViewIt', chr(13), 'windows in a FaceIt-based program.');
- FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
- end
- {Hit in Modeless Window's "Open Modal" Button}
- else if (uMenuID = 1000) and (wcHit = 2) then
- begin
- FaceIt(nil, NewWnd, 1001, 0, 0, 0); {Open Modal Window}
- repeat
- FaceIt(nil, MdlWnd, 1001, 0, 0, 0); {Process Modal Events}
- if (wcHit = -1) then {Hit in Close Box}
- leave
- else if (wcHit = 1) then {Hit in "Open Nested" Button}
- begin {Open Nested Modal}
- FaceIt(nil, NewWnd, 1002, 0, 110, ord(@myRec));
- FaceIt(nil, GetCtl, 1002, 0, 2, 3); {Setup Override Examples}
- FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
- FaceIt(nil, GetCtl, 1002, 0, 2, 6);
- FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
- FaceIt(nil, GetCtl, 1002, 0, 2, 7);
- FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
- FaceIt(nil, SetVal, 1002, 0, 0, 0); {Set Linked Values}
- helpShown := false;
- repeat
- FaceIt(nil, MdlWnd, 1002, 0, 0, 0); {Process Modal Events}
- if (wvHit = 1) then {Hit in View #1}
- if (wcHit = 1) then {Hit in "OK" Button}
- leave
- else if (wcHit = 2) then {Hit in "Show/Hide" Button}
- if helpShown then
- begin
- FaceIt(nil, ShoCtl, 0, 0, -3, 2); {Hide v3, Show v2}
- helpShown := false;
- end
- else
- begin
- FaceIt(nil, ShoCtl, 0, 0, -2, 3); {Hide v2, Show v3}
- helpShown := true;
- end;
- until false;
- FaceIt(nil, GetVal, 1002, 0, 0, 0); {Get Linked Values}
- FaceIt(nil, EndWnd, 1002, 0, 0, 0); {Close Nested Modal}
- end;
- until false;
- FaceIt(nil, EndWnd, 1001, 0, 0, 0); {Close Modal Window}
- end
- {Hit in Modeless Window's "Why ViewIt?" Button}
- else if (uMenuID = 1000) and (wcHit = 3) then
- begin
- FaceIt(nil, NewWnd, 1003, 0, 0, ord(@theReal));
- FaceIt(nil, SetVal, 1003, 0, 0, 0);
- repeat
- FaceIt(nil, MdlWnd, 1003, 0, 0, 0);
- until (wcHit = 1);
- FaceIt(nil, GetVal, 1003, 0, 0, 0);
- FaceIt(nil, EndWnd, 1003, 0, 0, 0);
- end;
- until false;
-
- end.